package com.mt.sdk.ble.model;

import java.util.HashMap;
import java.util.Map;

public class ErroCode {
	
	private int code;
	private String msg;
	public ErroCode(int code, String msg) {
		this.code = code;
		this.msg = msg;
	}
	
	public static Map<String, ErroCode> ERROMAP = new HashMap<String, ErroCode>();
	static {
		ERROMAP.put("OK", new ErroCode(0, "成功"));
		ERROMAP.put("bleunable", new ErroCode(1000, "没有开启蓝牙"));
		ERROMAP.put("busy", new ErroCode(1001, "忙，稍后再试"));
		ERROMAP.put("timeout", new ErroCode(1002, "超时"));
		ERROMAP.put("macerro", new ErroCode(1003, "mac错误"));
		ERROMAP.put("cantfinddevice", new ErroCode(1004, "找不到设备"));
		ERROMAP.put("scanerro", new ErroCode(1005, "扫描错误"));
		ERROMAP.put("unforturedis", new ErroCode(1006, "意外断开"));
		ERROMAP.put("unconnect", new ErroCode(1007, "未连接"));
		ERROMAP.put("null", new ErroCode(1008, "参数为空"));
		ERROMAP.put("getcharacterro", new ErroCode(1009, "未获取到特定特征值"));
		ERROMAP.put("enablenotifyerro", new ErroCode(1010, "使能可通知失败"));
		ERROMAP.put("disconnect", new ErroCode(1011, "未连接"));
		ERROMAP.put("cancel", new ErroCode(1012, "被取消"));
		
		ERROMAP.put("readuuiderro", new ErroCode(1013, "读取uuid失败"));
		ERROMAP.put("readmajorerro", new ErroCode(1014, "读取major失败"));
		ERROMAP.put("readminorerro", new ErroCode(1015, "读取minor失败"));
		ERROMAP.put("readmeasurederro", new ErroCode(1016, "读取measured失败"));
		ERROMAP.put("readsendpowerderro", new ErroCode(1017, "读取发射功率失败"));
		ERROMAP.put("readsendhzderro", new ErroCode(1018, "读取广播频率失败"));
		ERROMAP.put("readversionderro", new ErroCode(1019, "读取版本号失败"));
		
		ERROMAP.put("setuuiderro", new ErroCode(1020, "设置uuid失败"));
		ERROMAP.put("setmajorerro", new ErroCode(1021, "设置major失败"));
		ERROMAP.put("setminorerro", new ErroCode(1022, "设置minor失败"));
		ERROMAP.put("setmeasurederro", new ErroCode(1023, "设置measured失败"));
		ERROMAP.put("setsendpowerderro", new ErroCode(1024, "设置发射功率失败"));
		ERROMAP.put("setsendhzderro", new ErroCode(1025, "设置广播频率失败"));
		ERROMAP.put("setversionderro", new ErroCode(1026, "设置版本号失败"));
		
		ERROMAP.put("connnectfail", new ErroCode(1027, "连接失败"));
		ERROMAP.put("pwdfail", new ErroCode(1028, "密码验证失败"));
		ERROMAP.put("pwderro", new ErroCode(1029, "密码错误"));
		ERROMAP.put("readpublicparamsfail", new ErroCode(1030, "读取公共参数失败"));
		ERROMAP.put("readprivateparamsfail", new ErroCode(1031, "读取私有参数失败"));
		ERROMAP.put("setpublicparamsfail", new ErroCode(1032, "设置公共参数失败"));
		ERROMAP.put("setprivateparamsfail", new ErroCode(1033, "设置私有参数失败"));
		
		ERROMAP.put("setdevelopfail", new ErroCode(1034, "部署失败"));
		
		ERROMAP.put("appiderro", new ErroCode(1035, "账号或密码错误"));
		ERROMAP.put("interneterro", new ErroCode(1036, "网络错误"));
		
		ERROMAP.put("paramserro", new ErroCode(1037, "参数错误"));
		ERROMAP.put("lostdatas", new ErroCode(1038, "数据丢失"));
		
		ERROMAP.put("unknow", new ErroCode(1, "未知错误"));
	}
	public int getCode() {
		return code;
	}
	public String getMsg() {
		return msg;
	}
	
	public static final int CUSTOMCODE = -1;  // -1为自定义错误
	
	@Override
	public String toString() {
		return ("code->"+this.code+", msg->"+this.msg);
	}
}
